package com.jie.mc;

import com.jie.mc.commands.MyCommand;
import com.jie.mc.event.Entityevent;
import com.jie.mc.event.InventoryGuiEvent;
import com.jie.mc.event.PlayerEvent;
import com.jie.mc.util.VaultUtil;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    public static JavaPlugin plugin;
    @Override
    public void onEnable() {
/*        getLogger().info("另一种输出方式");
        System.out.println("我的第一个插件启动");*/
        plugin =this;
        if(VaultUtil.setupEconomy()){
            getLogger().info("初始化Vault插件成功");
        }
        else {
            getLogger().info("初始化Vault插件失败");
        }
        this.getCommand("renqi").setExecutor(new MyCommand());
        Bukkit.getPluginManager().registerEvents(new PlayerEvent(),this);
        Bukkit.getPluginManager().registerEvents(new Entityevent(),this);
        Bukkit.getPluginManager().registerEvents(new InventoryGuiEvent(),this);
        getLogger().info("________");
        getLogger().info("实训MC插件");
        getLogger().info("________");
        plugin=this;
        super.onEnable();
    }

/*
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        getLogger().info(label+"----"+ Arrays.toString(args));
        if (sender instanceof Player){
            sender.sendMessage("你是一个玩家");
        }
        else {
            sender.sendMessage("服务器命令行不能用这个命令");
        }
        return true;
    }
*/

    @Override
    public void onDisable() {
        System.out.println("我的第一个插件结束");
        super.onDisable();
    }
}
